package com.greenbook.dto;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.util.Date;
import java.util.List;

/**
 * 与es交互的笔记实体类
 */
@Data
@Document(indexName = "notes_index")
public class NoteDOC {
    @Id
    private String id;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String title;

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String content;

    @Field(type = FieldType.Keyword)
    private String noteCover;

    @Field(type = FieldType.Integer)
    private Integer noteCoverHeight;

    @Field(type = FieldType.Keyword)
    private String noteCategory;

    @Field(type = FieldType.Keyword)
    private String userId;

    @Field(type = FieldType.Keyword)
    private String nickname;

    @Field(type = FieldType.Keyword)
    private String avatar;

    @Field(type = FieldType.Keyword)
    private List<String> tags;

    @Field(type = FieldType.Integer)
    private Integer likeCount;

    @Field(type = FieldType.Integer)
    private Integer viewCount;

    @Field(type = FieldType.Date, format = DateFormat.epoch_millis)
    private Date createTime;

    @Field(type = FieldType.Date, format = DateFormat.epoch_millis)
    private Date updateTime;
}
